package com.hemaapp.yjnh.bean;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import xtom.frame.XtomObject;
import xtom.frame.exception.DataParseException;

/**粮票
 * @author ZhangGuiyou
 * Date: 2015-8-1 13:10
 */
public class Coupon extends XtomObject implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private String id;// 主键id
	private String client_id;// 用户id	 
	private String name;// 名称(赠送理由)	 
	private String code;// 券码
	private String fee;// 红包数量，一个整数	 
	private String minfee;// 最低消费
	private String useflag;// 状态	0：未使用 1：已使用 2：已过期
	private String startdate;// 可用开始日期
	private String enddate;// 可用结束日期
	private boolean isChecked = false;//是否被选择
	
	public Coupon(JSONObject jsonObject) throws DataParseException {
		if (jsonObject != null) {
			try {

				id = get(jsonObject, "id");
				client_id = get(jsonObject, "client_id");
				name = get(jsonObject, "name");
				code = get(jsonObject, "code");
				fee = get(jsonObject, "fee");
				minfee = get(jsonObject, "minfee");
				useflag = get(jsonObject, "useflag");
				startdate = get(jsonObject, "startdate");
				enddate = get(jsonObject, "enddate");

				log_i(toString());
			} catch (JSONException e) {
				throw new DataParseException(e);
			}
		}
	}
	
	@Override
	public String toString() {
		return "Blog [id=" + id + "client_id=" + client_id + "name=" +name + "code=" +code +
				"fee=" +fee + "minfee=" +minfee + "useflag=" +useflag + 
				"startdate=" +startdate + "enddate=" +enddate+ "]";
	}
	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	public String getclient_id() {
		return client_id;
	}

	public String getname() {
		return name;
	}
	
	public String getcode() {
		return code;
	}

	public String getfee() {
		return fee;
	}
	
	public String getminfee() {
		return minfee;
	}

	public String getuseflag() {
		return useflag;
	}

	public String getstartdate() {
		return startdate;
	}
	
	public String getenddate() {
		return enddate;
	}
	
	public boolean getChecked() {
		return isChecked;
	}
	
	public void setChecked(boolean checked) {
		this.isChecked = checked;
	}
}
